/**
 * @param {number[]} candidates
 * @param {number} target
 * @return {number[][]}
 */
var combinationSum = function(n, k) {
    const ans = []
    let path = []
    const backtracking = (i) => {
        if(path.length == k) {
            ans.push(JSON.parse(JSON.stringify(path)))
            return
        }
        for(let j = i; j <= n; j++) {
            path.push(j)
            backtracking(j + 1)
            path.pop()
        }
    }
    backtracking(1)
    return ans
 };